<template>
<div class="project">
    <a :href="data.url" target="_blank">
        <div class="foverlay">
            <span>
                <h3>{{ data.title }}</h3>
                <p>{{ data.detail }}</p>
            </span>
        </div>
        <img :src="data.img" />
    </a>
</div>
</template>

<script>
export default {
    name: "project",
    props: {
        data: {
            type: Object,
            default: () => {
                return {
                    title: "qimin",
                    img: "https://cdn.zhebk.cn/usr/themes/Akina//images/project/project1.jpg",
                    href: "/",
                };
            },
        },
    },
};
</script>

<style lang="less" scoped>
.project {
    width: inherit;
    padding: 10px 10px 8px 10px;
    box-shadow: 1px 1px 6px #eeebeb;
    -webkit-transition: 0.3s all ease-in-out;
    -o-transition: 0.3s all ease-in-out;
    transition: 0.3s all ease-in-out;

    &:hover {
        top: -2px;
        -webkit-box-shadow: 0 8px 50px -5px rgba(0, 0, 0, 0.1);
        box-shadow: 0 8px 50px -5px rgba(0, 0, 0, 0.1);
    }

    a {
        position: relative;
        display: block;
        overflow: hidden;

        &:hover {
            img {
                transform: scale(1.2);
            }
        }
    }

    img {
        width: 230px;
        height: 160px;
        object-fit: cover;
        border-radius: 5px;
        -webkit-transition: 0.3s all ease-in-out;
        -o-transition: 0.3s all ease-in-out;
        transition: 0.3s all ease-in-out;
    }

    & a:hover .foverlay {
        opacity: 1;
    }

    .foverlay {
        position: absolute;
        width: 230px;
        height: 100%;
        display: flex;
        justify-content: center;
        align-items: center;
        z-index: 2;
        text-align: center;
        background-color: rgba(73, 119, 194, 0.9);
        color: #fff;
        font-size: 12px;
        opacity: 0;
        border-radius: 5px;
        -moz-transition: opacity 0.4s ease-out;
        -o-transition: opacity 0.4s ease-out;
        -webkit-transition: opacity 0.4s ease-out;
        transition: opacity 0.4s ease-out;

        h3 {
            margin-bottom: 10px;
            font-size: 16px;
        }
    }
}
</style>
